Structures (Cont.)
Pascal C/C++
wvar
w
borrower: record
w
case IsStudent of
w
false: (EBorr: emploee);
w
true: (SBorr: student)
w
end;
wNO DIRECT EQUIVALENT IN
C. THIS CAN BE HANDLED BY CREATING A
STRUCT WHICH CONTAINS THE TAG AND A UNION AS ITS FIELDS. (SEE NEXT SLIDE)
EXAMPLE: Suppose
the types employee and student have been previously declared:
